﻿@model asMeishi.web.Models.shop
@using publicLibrary
@using asMeishi.web.Models

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Edit</h2>
<script src="/Content/manage/SWFUpload/swfupload_fp10/swfupload.js" type="text/javascript"></script>
<script src="/Content/manage/SWFUpload/plugins/swfupload.queue.js" type="text/javascript"></script>
<script src="/Content/manage/SWFUpload/plugins/fileprogress.js" type="text/javascript"></script>
<script src="/Content/manage/SWFUpload/plugins/handlers.js" type="text/javascript"></script>
<script src="/Content/manage/script/component.js" type="text/javascript"></script>
@using (Html.BeginForm()) {
    <fieldset>
        <legend>Fields</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.nameEN)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.nameEN)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.size)
        </div>
        <div class="editor-field">
            @Html.myHtmlDom("size", dictClass.get("shopSize"), selectType.下拉列表,Model.size.ToTryString());
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.longitudeAndLatitude)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.longitudeAndLatitude)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.addressStr)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.addressStr)
        </div>

@*        <div class="editor-label">
            @Html.LabelFor(model => model.classMain)
        </div>
        <div class="editor-field">
            @Html.myHtmlDom("_classMain", dictClass.get("shopClass"), selectType.多选, Model.classMain.trySplit())
            @Html.HiddenFor(model => model.classMain);
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.classOther)
        </div>
        <div class="editor-field">
            @Html.myHtmlDom("_classOther", dictClass.get("shopClass"), selectType.多选, Model.classOther.trySplit())
            @Html.HiddenFor(model => model.classOther);
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.classMore)
        </div>
        <div class="editor-field">
            @Html.myHtmlDom("_classMore", dictClass.get("shopClassMore"), selectType.多选, Model.classMore.trySplit())
               @Html.HiddenFor(model => model.classMore);
        </div>*@
                        <div class="editor-label">
                            @Html.LabelFor(model => model.web)
                        </div>
                        <div class="editor-field">
                            @Html.EditorFor(model => model.web)
                        </div>

                        <div class="editor-label">
                            @Html.LabelFor(model => model.intro)
                        </div>
                        <div class="editor-field">
                            @Html.TextAreaFor(model => model.intro)
                        </div>

                        <div class="editor-label">
                            @Html.LabelFor(model => model.quality)
                        </div>
                        <div class="editor-field">
                            @Html.TextBoxFor(model => model.quality, new {@class = "from_score" })
                        </div>

                        <div class="editor-label">
                            @Html.LabelFor(model => model.service)
                        </div>
                        <div class="editor-field">
                            @Html.TextBoxFor(model => model.service, new { @class = "from_score" })
                        </div>

                        <div class="editor-label">
                            @Html.LabelFor(model => model.priceQuality)
                        </div>
                        <div class="editor-field">
                            @Html.TextBoxFor(model => model.priceQuality, new { @class = "from_score" })
                        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.cost)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.cost)
        </div>


        <div class="editor-label">
            @Html.LabelFor(model => model.tags)
        </div>
        <div class="editor-field">

            <div id="unSelectTags">@string.Join(",", dictClass.get("shopTags_default").Select(d => d.Key))</div>
            
            <br/>
            @Html.TextAreaFor(model => model.tags, new { @id = "selectTags" })<br/>
            <input type="text" name="newShopTag" id="newShopTag" /><button type="button"  onclick="addNewTag('newShopTag','selectTags')">添加</button>
            <script language="javascript">selectTagsAPP("unSelectTags","selectTags",1)</script>
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.picUrlList)
        </div>
        <div class="editor-field">
            @*@string.Join(",",Model.picUrlList)*@
            
            @Model.picUrlList.ListToHTMLbyCode("<img src='\\upload\\pic\\s\\_var_' class='xxx'/>")
        </div>

    </fieldset>
}
        <!---上传组件部分---->
        <div class="upload">
            <div class="flashUpload" id="flashUpload">

                <div id="SWFUploadTarget"></div>
                <fieldset class="fsUploadProgress"  id="fsUploadProgress">
                    <legend class="legend">上传队列</legend>
                </fieldset>
                <button type="button" id="spanButtonPlaceHolder">上传</button><input id="btnCancel" type="button" value="Cancel All Uploads" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
            </div>
            <div class="htmlUpload" id="htmlUpload">
                <form  action="/shop/Ajax_addPic" method="post" enctype="multipart/form-data">
                    <div id="uploadElement">
                        <div class="item">
                            <input type="file" name="filedata"/><button type="button" onclick="myHtmlUpload.delEl(this)">del</button>
                        </div>
                    </div>
                    <button type="button" onclick="myHtmlUpload.addEl()">增加</button>
                    <button type="sbumit" onlcick="">上传</button>
                </form>                
            </div>
        </div>
        <div class="clearFloat"></div>
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
<script>
    function bulidFlash_shopPic(){
        swfu = new SWFUpload({
            upload_url: "/shop/Ajax_addPic",
            flash_url: "/Content/manage/SWFUpload/swfupload_fp10/swfupload.swf",

            post_params: { "PHPSESSID": "" },
            file_size_limit: "100 MB",
            file_types: "*.jpg;*.gif",
            file_types_description: "Web Image Files",

            file_upload_limit: 100,
            file_queue_limit: 0,
            custom_settings: {
                progressTarget: "fsUploadProgress",
                cancelButtonId: "btnCancel"
            },
            debug: false,

            // Button settings
            button_image_url: "images/TestImageNoText_65x29.png",
            button_width: "65",
            button_height: "29",
            button_placeholder_id: "spanButtonPlaceHolder",
            button_text: '<span class="theFont">上传图片</span>',
            button_text_style: ".theFont { font-size: 12; }",
            button_text_left_padding: 12,
            button_text_top_padding: 3,

            // The event handler functions are defined in handlers.js
            swfupload_preload_handler: preLoad,
            swfupload_load_failed_handler: loadFailed,
            file_queued_handler: fileQueued,
            file_queue_error_handler: fileQueueError,
            file_dialog_complete_handler: fileDialogComplete,
            upload_start_handler: uploadStart,
            upload_progress_handler: uploadProgress,
            upload_error_handler: uploadError,
            upload_success_handler: uploadSuccess,
            upload_complete_handler: uploadComplete,
            //queue_complete_handler: queueComplete	// Queue plugin event

            post_params: { "shopId": "@Model.Id" }



        })
    return swfu;

}
    var myHtmlUpload//
    $(document).ready(function () {
            var shopPicFlashUpload = bulidFlash_shopPic();
            //shopPicFlashUpload.setPostParams({"shopId":"@Model.Id"})
            bulidHtmlUpload();
            myHtmlUpload = new HtmlUpload("uploadElement");
        })

        function bulidHtmlUpload() {
            /*弹地出iframe
            var htmlUploadLayer = document.createElement("div");
            htmlUploadLayer.className = "htmlUploadLayerCls";
            var htmlUploadIframe = document.createElement("iframe");
            htmlUploadIframe.src = "/Content/html/iframe_addPic.html"
            htmlUploadIframe.className = "iframe";
            htmlUploadLayer.appendChild(htmlUploadIframe)
            document.body.appendChild(htmlUploadLayer)
            */

            
    }

</script>

